<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateQiiLanguageScriptTable extends Migration
{
    /**
     * Schema table name to migrate
     * @var string
     */
    public $set_schema_table = 'qii_language_script';

    /**
     * Run the migrations.
     * @table qii_language_script
     *
     * @return void
     */
    public function up()
    {
        if (Schema::hasTable($this->set_schema_table)) return;
        Schema::create($this->set_schema_table, function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->increments('script_id')->comment('写入ID');
            $table->string('code', 4)->default('')->comment('code');
            $table->unsignedSmallInteger('num')->default('0')->comment('编号');
            $table->string('cn_name', 100)->default('')->comment('中文名称');
            $table->string('en_name', 200)->default('')->comment('英文名称');
            $table->string('alias', 50)->default('')->comment('别名');
            $table->string('direction', 15)->default('')->comment('录入方向');
            $table->string('version', 15)->default('')->comment('版本');
            $table->string('characters', 15)->default('');
            $table->string('remark')->default('')->comment('备注');
            $table->unsignedTinyInteger('status')->default('2')->comment('1:启用|2:禁用');
            $table->unsignedInteger('modified_date')->default('0')->comment('修改时间');

            $table->unique(["code"], 'code');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
     public function down()
     {
       Schema::dropIfExists($this->set_schema_table);
     }
}
